/***************************************************************************
 *   Copyright (C) 2009 by Marian Skvarek   *
 *   skvarek.marian@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A TrackICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
 
#ifndef EASYSCORE_CORECTRACK_H
#define EASYSCORE_CORECTRACK_H

#include "CClef.h"
#include "CGlobals.h"
#include "CPart.h"

#include <QLinkedList>

namespace easyscore
{
	namespace core
	{
		class CTrackView;
		class CScore;
		class CBar;
                class CSymbol;

		/** 
			Abstract Track.
			@author Marian Skvarek <skvarek.marian@gmail.com>
		*/
 		class CTrack
		{
//Static methods
			public:
				
//Members
			protected:
				QLinkedList<CBar *> mBars;
				CClef mClef;
                                int mID;

				CPart *mParentPart;


				bool mInitialized;
				
				CTrackView *mView;

//Accessors
			public:
				QLinkedList< CBar * > &getBars() { return mBars; }
				void setClef ( const CClef& value ) { mClef = value; }
				CClef &getClef() { return mClef; }
                                void setID(int value) { mID = value; }
                                int getID() { return mID; }
				void setParentPart ( CPart* value ) { mParentPart = value; }
				CPart* getParentPart() const { return mParentPart; }
				CScore *getParentScore() const { return mParentPart->getParentScore(); }
				
				CTrackView *getView() const { return mView; }

//Constructors, Initialization & Destructors
			public:
				CTrack ( CPart *parentPart = 0 );
                                void initialize(bool addOneBar = true);
				
				void clear();
				~CTrack();
				

					
//Public methods
			public:			
                                CBar *addBar();
				void addBar(CBar *bar);
				void removeBar(CBar *bar);
                                QLinkedList<CSymbol *> getSymbols();

                                void setActiveBars(int start, int count, bool value);
				
				bool hasView() { return mView != 0; }
				void createView();
				void destroyView();

//Protected methods
                        public:
				void updateView();



		};//class CTrack
	}//namespace core
}//namespace easyscore

#endif
